package cn.ymkj.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("后端接口统一返回类型")
public class R {
    @ApiModelProperty("响应状态码： 成功200  失败500")
    private Integer status;  //状态码： 成功200  失败500
    @ApiModelProperty("响应提示信息")
    private String message;  //信息
    @ApiModelProperty("响应的具体数据")
    private Object data;

    public static R ok(){
        return new R(200,"",null);
    }

    public static R ok(String message){
        return new R(200,message,null);
    }

    public static R ok(String message, Object data){
        return new R(200,message,data);
    }

    public static R no(){
        return new R(500,"",null);
    }

    public static R no(String message){
        return new R(500,message,null);
    }

    public static R no(String message, Object data){
        return new R(500,message,data);
    }


    public R() {
    }

    public R(Integer status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
